----------------------------------
--      Module Declaration      --
----------------------------------

local boss = BB["Moorabi"]
local mod = BigWigs:New(boss, tonumber(("$Revision: 543 $"):sub(12, -3)))
if not mod then return end
mod.partyContent = true
mod.otherMenu = "Zul'Drak"
mod.zonename = BZ["Gundrak"]
mod.enabletrigger = boss 
mod.guid = 29305
mod.toggleoptions = {"transformation", "transformationBar", "bosskill"}
mod.revision = tonumber(("$Revision: 543 $"):sub(12, -3))

----------------------------------
--        Are you local?        --
----------------------------------

local transSpellName = GetSpellInfo(55098)

----------------------------------
--         Localization         --
----------------------------------

local L = AceLibrary("AceLocale-2.2"):new("BigWigs"..boss)

L:RegisterTranslations("enUS", function() return {
	cmd = "Moorabi",
	transformation = "Transformation",
	transformationBar = "Transformation Casting Bar",
	transformationBar_desc = "Show a casting bar for Transformation.",
	transformation_desc = "Warn when Moorabi begins to cast Transformation",
	transformation_message = "Casting Transformation",
}

end )

L:RegisterTranslations("deDE", function() return {
	cmd = "Moorabi",
	transformation = "Transformation",
	transformationBar = "Transformation-Zauberleiste",
	transformationBar_desc = "Eine Zauberleiste für die Transformation anzeigen.",
	transformation_desc = "Warnen wenn Moorabi beginnt seine Transformation auszuführen.",
	transformation_message = "Transformation beginnt!",
}

end )

L:RegisterTranslations("esES", function() return {
}

end )

L:RegisterTranslations("esMX", function() return {
}

end )

L:RegisterTranslations("frFR", function() return {
	cmd = "Moorabi",
	transformation = "Transformation",
	transformationBar = "Transformation - Barre",
	transformationBar_desc = "Affiche une barre indiquant le temps d'incantation de la Transformation.",
	transformation_desc = "Prévient quand Moorabi commence à incanter sa Transformation.",
	transformation_message = "Transformation en incantation",
}

end )

L:RegisterTranslations("koKR", function() return {
	cmd = "무라비",
	transformation = "변신",
	transformationBar = "변신 시전 바",
	transformationBar_desc = "변신 시전 바를 표시합니다.",
	transformation_desc = "무라비의 변신을 알립니다.",
	transformation_message = "변신 시전!",
}

end )

L:RegisterTranslations("ruRU", function() return {
	cmd = "Мураби",
	transformation = "Преображение",
	transformationBar = "Полоса Преображения",
	transformationBar_desc = "Отображать полосу применения Преображения.",
	transformation_desc = "Предупреждать когда Мураби начинает применять Преображение.",
	transformation_message = "Применияется Преображение!",
}

end )

L:RegisterTranslations("zhCN", function() return {
	transformation = "变形",
	transformationBar = "施放变形计时条",
	transformationBar_desc = "当正在施放变形时显示计时条。",
	transformation_desc = "当莫拉比正在施放变形时发出警报。",
	transformation_message = "正在施放 变形！",
}

end )

L:RegisterTranslations("zhTW", function() return {
	cmd = "慕拉比",
	transformation = "變形",
	transformationBar = "施放變形計時條",
	transformationBar_desc = "當正在施放變形時顯示計時條。",
	transformation_desc = "當慕拉比開始施放變形時發出警報。",
	transformation_message = "正在施放 變形！",
}

end )

----------------------------------
--        Initialization        --
----------------------------------

function mod:OnEnable()
	self:AddCombatListener("SPELL_CAST_START", "Transform", 55098)
	self:AddCombatListener("SPELL_INTERRUPT", "Interrupt", 32747) -- spellId of Interrupt
	self:AddCombatListener("UNIT_DIED", "BossDeath")
end

------------------------------
--      Event Handlers      --
------------------------------

function mod:Transform(_, spellId, _, _, spellName)
	if self.db.profile.transformation then
		self:IfMessage(L["transformation_message"], "Urgent", spellId)
	end
	if self.db.profile.transformationBar then
		self:Bar(transSpellName, 4, spellId)
	end
end

function mod:Interrupt(_, _, source)
	if self.db.profile.transformationBar and source == boss then
		self:TriggerEvent("BigWigs_StopBar", self, transSpellName)
	end
end
